class CreatePhotos < ActiveRecord::Migration
  def self.up
    create_table :photos do |t|
      t.column :post_id, :integer, :null => false
      t.column :title, :string
      t.column :caption, :text
      t.column :image_url, :string
      t.column :thumbnail_url, :string
      t.column :pick, :boolean
      t.column :shutter_speed, :float
      t.column :aperture, :float
      t.column :camera, :string
      t.column :data_taken, :date
      t.column :iso, :integer
      t.column :tags, :text
    end
    
    execute "alter table photos add constraint fk_photos_posts 
      foreign key (post_id) references posts(id)"
    
  end

  def self.down
    drop_table :photos
  end
end
